<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="<?= base_url() ?>assets/js/libs/jquery-1.8.0.min.js"><\/script>')</script>
<script src="<?= base_url() ?>assets/js/libs/bootstrap.min.js"></script>
<!--<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>-->
<script src="<?= base_url() ?>assets/js/libs/jquery.mousewheel.js"></script>
<script src="<?= base_url() ?>assets/js/libs/hoverIntent.js"></script>
<script src="<?= base_url() ?>assets/js/libs/jquery.validate.min.js"></script>
<script src="<?= base_url() ?>assets/js/libs/jquery.loadmask.min.js"></script>

<script src="<?= SCRIPT_PATH ?>js/libs/jquery-ui.min.js"></script>
<script src="<?= SCRIPT_PATH ?>js/libs/jquery.easing.1.3.js"></script>
<script src="<?= base_url() ?>assets/js/libs/superfish.js"></script>

<? if ($this->lang->mci_current() != 'en'): ?>
<script src="<?= base_url() ?>assets/js/libs/datepicker_regional/jquery.ui.datepicker-<?= $this->lang->mci_current() ?>.js"></script>
<? endif; ?>

<script src="<?= base_url() ?>assets/js/plugins.js"></script>

<!--[if (gte IE 6)&(lte IE 8)]>
<script type="text/javascript" src="<?= base_url() ?>assets/js/libs/selectivizr-min.js"></script>
<![endif]-->


<script>
    var API = API || {};
    API = {
        Data: {
            base_url: '<?= base_url(); ?>',
            libs_url: '<?= SCRIPT_PATH; ?>',
            lang_url: '<?= lang_url(); ?>',
            method: '<?= $this->router->fetch_method(); ?>',
            cur_lang: '<?= $this->lang->mci_current(); ?>',
            HOST_URL_HOTELS: '<?= HOST_URL_HOTELS; ?>',
            lang: {
                'top_custom_search': "<?= lang('top.custom_search'); ?>",
                'form_dest_region': "<?= lang('form.dest_region'); ?>",
                'form_person': "<?= lang('form.person'); ?>",
                'form_persons': "<?= lang('form.persons'); ?>",
                'form_show_all_items': "<?= lang('form.show_all_items'); ?>",
                'filter_filtering': "<?= lang('filter.filtering'); ?>",
                'dtl_adults': "<?= lang('dtl.adults'); ?>",
                'dtl_teenagers': "<?= lang('dtl.teenagers'); ?>",
                'dtl_children': "<?= lang('dtl.children'); ?>",
                'dtl_babies': "<?= lang('dtl.babies'); ?>",
                'days': "<?= lang('days'); ?>",
                'book_now': "<?= lang('res.book_now'); ?>",
                'calculating': "<?= lang('calculating'); ?>",
                'dtl_subscribing': "<?= lang('dtl.subscribing'); ?>",
                'dtl_subscribe_thanks': "<?= lang('dtl.subscribe_thanks'); ?>",
                'dtl_subscribe_alredy': "<?= lang('dtl.subscribe_alredy'); ?>",
                'dtl_posting_question': "<?= lang('dtl.posting_question'); ?>",
                'dtl_posting_thanks': "<?= lang('dtl.posting_thanks'); ?>",
                'available': "<?= lang('available'); ?>",
                'occupied': "<?= lang('occupied'); ?>",
                'selected': "<?= lang('selected'); ?>",
                'arrival': "<?= lang('arrival'); ?>",
                'departure': "<?= lang('departure') ?>",
                'read_more': "<?= lang('read_more') ?>",
                'close': "<?= lang('close') ?>"
            },
        }
    };
</script>

<!--<script src="<?= base_url() ?>assets/js/helper.js"></script>-->
<script src="<?= base_url() ?>assets/js/main.js"></script>
<?php
    $method = $this->router->fetch_method();
    $class = $this->router->fetch_class();
    switch ($method) {
        case $method == 'index' && ($class == 'main' || $class == 'excursions'):
            ?>
            <script src="<?= base_url() ?>assets/js/libs/responsiveslides.min.js"></script>
            <?php
            break;

        case $method == 'search' && ($class == 'main' || $class == 'excursions'):
            ?>
            <script src="<?= base_url() ?>assets/js/libs/jquery.multi-accordion-1.5.3.js"></script>
            <script src="<?= base_url() ?>assets/js/libs/underscore-min.js"></script>
            <script src="<?= base_url() ?>assets/js/libs/jquery.scrollTo-min.js"></script>
            <?php
            break;

        case $method == 'accommodation' && $class == 'main':
            ?>
            <script src="<?= base_url() ?>assets/js/libs/jquery.jcarousel.min.js"></script>
            <script src="<?= base_url() ?>assets/js/libs/jquery.pikachoose.min.js"></script>
            <script src="<?= base_url() ?>assets/js/libs/jquery.scrollTo-min.js"></script>
            <?php
            break;
    }
?>


<?php
    switch ($method) {
        case $method == 'index' && ($class == 'main' || $class == 'excursions'):
            ?>
            <script src="<?= base_url() ?>assets/js/index.js"></script>
            <?php
            break;

        case $method == 'search' && $class == 'main' :
            ?>
            <script src="<?= SCRIPT_PATH ?>js/libs/jquery.pajinate.min.js"></script>
            <script src="<?= SCRIPT_PATH ?>js/api/x_mask.js"></script>
            <script src="<?= SCRIPT_PATH ?>js/api/x_sorter.js"></script>
            <script src="<?= SCRIPT_PATH ?>js/api/x_pager.js"></script>
            <script src="<?= SCRIPT_PATH ?>js/api/x_slider.js"></script>
            <script src="<?= SCRIPT_PATH ?>js/api/x_filter.js"></script>
            <script src="<?= base_url() ?>assets/js/filter.js"></script>
            <?php
            break;

        case 'accommodation':
            ?>
            <script src="<?= base_url() ?>assets/js/accommodation.js"></script>
            <script src="<?= SCRIPT_PATH ?>js/api/x_calculation.js"></script>
            <script src="<?= SCRIPT_PATH ?>js/api/x_calendar.js"></script>
            <script src="<?= base_url() ?>assets/js/calendar.js"></script>
            <?php
            break;

        case 'excursion_view':
        case 'transfers_view':
        case 'top_offer_view':
        case 'transfers_view':
        case 'cipatravel':
            ?>
            <script src="<?= SCRIPT_PATH ?>js/libs/jquery.prettyPhoto.js"></script>
            <script src="<?= base_url() ?>assets/js/excursion.js"></script>
            <script src="<?= base_url() ?>assets/js/cms_table_style.js"></script>
            <script>
                $("a[rel^='prettyPhoto[pp_gal]']").prettyPhoto({animation_speed: 'normal'});
            </script>

            <?php
            break;


        case 'excursion':
        case 'transfers':
            ?>
            <script src="<?= base_url() ?>assets/js/cms_table_style.js"></script>
            <?php
            break;
    }
?>

<?php if (($method === 'index' || $method === 'search' || $method === 'accommodation') && ($class == 'main' || $class == 'excursions' || $class == 'transfers')): ?>

        <script src="<?= SCRIPT_PATH ?>js/libs/jquery.colorbox-min.js"></script>
        <script src="<?= SCRIPT_PATH ?>js/api/form.js"></script>

    <?php endif; ?>

<?php if (($method === 'index' || $method === 'search') && ($class == 'main' || $class == 'excursions')): ?>

        <script src="<?= base_url() ?>assets/js/form.js"></script>

    <?php endif; ?>

<?php if ($method === 'index' && $class === 'excursions'): ?>


        <script src="<?= SCRIPT_PATH ?>js/libs/jquery.pajinate.min.js"></script>
        <script src="<?= base_url() ?>assets/js/libs/jquery.scrollTo-min.js"></script>
        <script src="<?= base_url() ?>assets/js/searchExc.js"></script>


    <?php endif; ?>

<?php if ($method === 'detailsExc' && $class === 'excursions'): ?>


        <script src="<?= base_url() ?>assets/js/libs/jquery.jcarousel.min.js"></script>
        <script src="<?= base_url() ?>assets/js/libs/jquery.pikachoose.min.js"></script>
        <script src="<?= base_url() ?>assets/js/libs/jquery.scrollTo-min.js"></script>
        <script src="<?= SCRIPT_PATH ?>js/api/x_picker.js"></script>
        <script src="<?= base_url() ?>assets/js/excForm.js"></script>
        <script src="<?= base_url() ?>assets/js/excCalculation.js"></script>
        <script src="<?= base_url() ?>assets/js/detailsExc.js"></script>


    <?php endif; ?>

<?php if (($method === 'index' || $method === 'search') && ($class === 'transfers')): ?>


        <script src="<?= base_url() ?>assets/js/transfers.js"></script>


    <?php endif; ?>

<?php if (($method === 'index' || $method === 'search' || $method === 'accommodation') && $class == 'main'): ?>

        <script type="text/javascript">


            function downloadJSAtOnload() {  // Add a script element as a child of the body

                loadGMAPScript = function () {

//                    var element0 = document.createElement("script");
//                    element0.src = API.Data.libs_url + "js/libs/markerclusterer_packed.js";
////                    element0.src = "http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerclusterer/1.0.2/src/markerclusterer.js";
//                    document.body.appendChild(element0);

                    var element1 = document.createElement("script");
                    element1.src = API.Data.libs_url + "js/api/x_google_map.js";
                    document.body.appendChild(element1);

                    var element2 = document.createElement("script");
                    element2.src = API.Data.base_url + "assets/js/google_map.js";
                    document.body.appendChild(element2);

                }

                var element = document.createElement("script");
                element.type = "text/javascript";
                element.src = "https://maps.googleapis.com/maps/api/js?key=AIzaSyA8S8GdXphRexN5dRL-A5o4GDvBqMFx-iI&sensor=false&callback=loadGMAPScript";
                document.body.appendChild(element);

            }

            $(window).load(function () {
                downloadJSAtOnload();
            });


        </script>
    <?php endif; ?>

<?php if ($method == 'accommodation' || ($method === 'detailsExc' && $class === 'excursions')): ?>

        <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-51f824181d73dd18"></script>


    <?php endif; ?>

<script>
    (function (i, s, o, g, r, a, m) {
        i['GoogleAnalyticsObject'] = r;
        i[r] = i[r] || function () {
            (i[r].q = i[r].q || []).push(arguments)
        }, i[r].l = 1 * new Date();
        a = s.createElement(o),
                m = s.getElementsByTagName(o)[0];
        a.async = 1;
        a.src = g;
        m.parentNode.insertBefore(a, m)
    })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');

    ga('create', 'UA-42570339-1', 'cipa-booking.com');
    ga('send', 'pageview');

</script>